<?php include dirname(__FILE__).'/common/header.php'; ?>

<?php include dirname(__FILE__).'/common/menu.php'; ?>

var attr = {};
attr.ctrlName = '<?php echo $ctrlName; ?>';
attr.code_type = <?php echo $code_type ?>;
/*
| -------------------------------------------------------------------
|  List Grid
| -------------------------------------------------------------------
*/
list.grid = new ZM.GridPanel({
    url: list.baseUrl + attr.ctrlName+'/getCodeList',
    tbar:[{
        text:'导入视频网站会员兑换码',
        cls:'btn-show',
        handler:function() {
            var win = new ZM.PopUp({
                title:'导入视频网站会员兑换码',
                type:'s',
                labelWidth: 120,
                items:{
                    xtype:'formpanel',
                    url:list.baseUrl+ attr.ctrlName+'/importList',
                    fileUpload:true,
                    success:function(res) {
                        ZM.bo.msg('success',res.detail);
                        list.grid.store.reload();
                        win.close();
                    },
                    items:[{
                        xtype:'hidden',
                        name:'type',
                        value:2
                    },{
                        inputType:'file',
                        fieldLabel:'视频网站会员兑换码(excel)',
                        name:'file',
                        allowBlank:false
                    }]
                }
            }).show();
        }
    },'-',{
        text:'导入电影票',
        cls:'btn-show',
        handler:function() {
            var win = new ZM.PopUp({
                title:'导入电影票',
                type:'s',
                items:{
                    xtype:'formpanel',
                    url:list.baseUrl+ attr.ctrlName+'/importList',
                    fileUpload:true,
                    success:function(res) {
                        ZM.bo.msg('success',res.detail);
                        list.grid.store.reload();
                        win.close();
                    },
                    items:[{
                        xtype:'hidden',
                        name:'type',
                        value:3
                    },{
                        inputType:'file',
                        fieldLabel:'电影票(excel)',
                        name:'file',
                        allowBlank:false
                    }]
                }
            }).show();
        }
    }],
    columns:[
        {header:'顾客ID',dataIndex:'customer_id',filter:{}},
        {header:'openid',dataIndex:'openid',width:150,filter:{}},
        {header:'类别',dataIndex:'code_type',width:150,renderer:function(val) {
            var str = ZM.id2name(val,attr.code_type);
            return str;
        },filter:{
            xtype:'combofield',
            options:[['','全部']].concat(attr.code_type)
        }},
        {header:'序号',dataIndex:'code_number',filter:{}},
        //{header:'验证码',dataIndex:'code_code',filter:{}},
        {header:'状态',dataIndex:'code_status',filter:{}},
        {header:'创建时间',dataIndex:'code_time_create',width:140},
        {header:'激活时间',dataIndex:'code_time_active',width:140}
    ]
});
/*
| -------------------------------------------------------------------
|  List Grid Action
| -------------------------------------------------------------------
*/


<?php include dirname(__FILE__).'/common/layout.php'; ?>
list.grid.store.load();
<?php include dirname(__FILE__).'/common/footer.php'; ?>